mod login_state;
mod tray;
mod my_system;

#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_notification::init())
        .plugin(tauri_plugin_dialog::init())
        .plugin(tauri_plugin_opener::init())
        .invoke_handler(tauri::generate_handler![
            greet,
            login_state::set_login_status,
            login_state::get_login_status,
            tray::create_tray,
            tray::destroy_tray,
            my_system::app_exit,
            my_system::destroy_all_windows_except_tray
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
